package com.hainingtong.user.util;

import java.util.Random;

public class Utils {

    /**
     * 生成验证码
     * @return
     */
    public static String generateCode() {
        String str = "0123456789";
        StringBuilder sb = new StringBuilder(4);
        for (int i = 0; i < 4; i++) {
            char ch = str.charAt(new Random().nextInt(str.length()));
            sb.append(ch);
        }
        return sb.toString();
    }
}
